<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Reponseparticipant extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Idreponseparticipant;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_Reponse;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Datereponse;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Score;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_ParticipationIdparticipation;


    /**
     * Parent relation fk_reponseparticipant_participation1
     *
     * @var Application_Model_Participation
     */
    protected $_Participation;


    /**
     * Dependent relation fk_listesreponse_reponseparticipant1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Listesreponse
     */
    protected $_Listesreponse;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idreponseparticipant'=>'Idreponseparticipant',
            'reponse'=>'Reponse',
            'datereponse'=>'Datereponse',
            'score'=>'Score',
            'participation_idparticipation'=>'ParticipationIdparticipation',
        ));

        $this->setParentList(array(
            'FkReponseparticipantParticipation1'=> array(
                    'property' => 'Participation',
                    'table_name' => 'Participation',
                ),
        ));

        $this->setDependentList(array(
            'FkListesreponseReponseparticipant1' => array(
                    'property' => 'Listesreponse',
                    'table_name' => 'Listesreponse',
                ),
        ));
    }

    /**
     * Sets column idreponseparticipant
     *
     * @param int $data
     * @return Application_Model_Reponseparticipant
     */
    public function setIdreponseparticipant($data)
    {
        $this->_Idreponseparticipant = $data;
        return $this;
    }

    /**
     * Gets column idreponseparticipant
     *
     * @return int
     */
    public function getIdreponseparticipant()
    {
        return $this->_Idreponseparticipant;
    }

    /**
     * Sets column reponse
     *
     * @param string $data
     * @return Application_Model_Reponseparticipant
     */
    public function setReponse($data)
    {
        $this->_Reponse = $data;
        return $this;
    }

    /**
     * Gets column reponse
     *
     * @return string
     */
    public function getReponse()
    {
        return $this->_Reponse;
    }

    /**
     * Sets column datereponse
     *
     * @param int $data
     * @return Application_Model_Reponseparticipant
     */
    public function setDatereponse($data)
    {
        $this->_Datereponse = $data;
        return $this;
    }

    /**
     * Gets column datereponse
     *
     * @return int
     */
    public function getDatereponse()
    {
        return $this->_Datereponse;
    }

    /**
     * Sets column score
     *
     * @param int $data
     * @return Application_Model_Reponseparticipant
     */
    public function setScore($data)
    {
        $this->_Score = $data;
        return $this;
    }

    /**
     * Gets column score
     *
     * @return int
     */
    public function getScore()
    {
        return $this->_Score;
    }

    /**
     * Sets column participation_idparticipation
     *
     * @param int $data
     * @return Application_Model_Reponseparticipant
     */
    public function setParticipationIdparticipation($data)
    {
        $this->_ParticipationIdparticipation = $data;
        return $this;
    }

    /**
     * Gets column participation_idparticipation
     *
     * @return int
     */
    public function getParticipationIdparticipation()
    {
        return $this->_ParticipationIdparticipation;
    }

    /**
     * Sets parent relation ParticipationIdparticipation
     *
     * @param Application_Model_Participation $data
     * @return Application_Model_Reponseparticipant
     */
    public function setParticipation(Application_Model_Participation $data)
    {
        $this->_Participation = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idparticipation'];
        }

        $this->setParticipationIdparticipation($primary_key);

        return $this;
    }

    /**
     * Gets parent ParticipationIdparticipation
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Participation
     */
    public function getParticipation($load = true)
    {
        if ($this->_Participation === null && $load) {
            $this->getMapper()->loadRelated('FkReponseparticipantParticipation1', $this);
        }

        return $this->_Participation;
    }

    /**
     * Sets dependent relations fk_listesreponse_reponseparticipant1
     *
     * @param array $data An array of Application_Model_Listesreponse
     * @return Application_Model_Reponseparticipant
     */
    public function setListesreponse(array $data)
    {
        $this->_Listesreponse = array();

        foreach ($data as $object) {
            $this->addListesreponse($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_listesreponse_reponseparticipant1
     *
     * @param Application_Model_Listesreponse $data
     * @return Application_Model_Reponseparticipant
     */
    public function addListesreponse(Application_Model_Listesreponse $data)
    {
        $this->_Listesreponse[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_listesreponse_reponseparticipant1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Listesreponse
     */
    public function getListesreponse($load = true)
    {
        if ($this->_Listesreponse === null && $load) {
            $this->getMapper()->loadRelated('FkListesreponseReponseparticipant1', $this);
        }

        return $this->_Listesreponse;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Reponseparticipant
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Reponseparticipant());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Reponseparticipant::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdreponseparticipant() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idreponseparticipant = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdreponseparticipant()));
    }
}
